// L08_20230316.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/core/utils/logger.hpp>
using namespace cv;
using namespace std;

int main()
{
	cv::utils::logging::setLogLevel(utils::logging::LOG_LEVEL_SILENT);
	///////////  ÏÔÊ¾ OpenCV °æ±¾ºÅ  ////////////// 
	std::cout << "\n---------------------------------\n";
	std::cout << "OpenCV version: " << CV_VERSION << endl;
	std::cout << "\n---------------------------------\n";

	//////////////////////////////////// 
	// 1. ¶ÁÈëÒ»·ùÍ¼Ïñ //////////////////
	Mat img = imread("E:\\UCASCourse2023\\code\\data\\lena.jpg");
	if (!img.empty()) {
		Size imgsize;
		imgsize = img.size();
		std::cout << "image size is: " << imgsize.height << "*" << imgsize.width << "\n";

		imshow("²ÊÉ«Í¼Ïñ", img);
		cv::waitKey(0);

		// 4. ·ÂÉä±ä»»¡ª¡ªÐý×ª
		Mat affineImg;
		Mat M;
		M = getRotationMatrix2D(Point2f(0, 0), 45, 1);
		cout << "±ä»»¾ØÕó£º\n" << M;
		warpAffine(img, affineImg, M, Size(imgsize.width, imgsize.height));
		imshow("·ÂÉä±ä»»ºó£¨Ðý×ª£©", affineImg);
		cv::waitKey(0);

	}
}